﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ECommerce.BLL.Product;
using ECommerce.Model.Product;


namespace ECommerce.Web.Site.controls
{
    public partial class SaleRank : System.Web.UI.UserControl
    {
        private ECProductBO Product
        {
            get
            {
                return ECProductBO.Instance<ECProductBO>();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindView();
            }
        }

        private void BindView()
        {
            List<ECProductInfo> list = Product.GetTopList(5);
            for (int i = 1; i <= list.Count; i++)
            {
                list[i-1].Index = i;
            }
            rpt.DataSource = list;
            rpt.DataBind();
        }
    }
}